(define a 1024)
(define b 1024)

(define (mul a b)
    (if (= b 0)
        0
        (+ a (mul a (- b 1)))))
        
(display (mul a b))
(newline)

(define (fast-mul a b)
    (define (double x) (+ x x))
    (define (halve x) (/ x 2))
    (define (even? x) (= (remainder x 2) 0))
    
    (cond ((= 0 b) 0)
        ((even? b) (fast-mul (double a) (halve b)))
        (else (+ a (fast-mul a (- b 1)) ))))
        
(display (fast-mul a b))
        